/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1697600289744_4255';

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  // 让post请求可以成功
  config.security = {
    csrf: {
      enable: false
    }
  };
  // 跨域
  config.cors = {
    origin: "*",
    allowMethods: "GET, HEAD, PUT, POST, DELETE, PATCH"
  };
  // jwt插件
  config.jwt = {
    // 密钥
    secret: 'ethink'
  };
  // 数据持久化模型插件
  config.sequelize = {
    dialect: 'mysql',
    database: 'ethink',
    host: 'localhost',
    port: 3306,
    username: 'root',
    password: '123456'
  }

  // 项目部署静态目录
  config.static = {
    prefix: '/',
    dir: path.join(appInfo.baseDir, 'app/public')
  }

  return {
    ...config,
    ...userConfig,
  };
};
